package com.example.hospital.service.impl;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.example.hospital.mapper.SymptomMapper;
import com.example.hospital.pojo.ResPageBean;
import com.example.hospital.pojo.Symptom;
import com.example.hospital.service.ISymptomService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class ISymptomServiceImpl extends ServiceImpl<SymptomMapper, Symptom> implements ISymptomService {
    @Autowired
    private SymptomMapper symptomMapper;
    @Override
    public ResPageBean getSymptomByPage(Integer currentPage, Integer size,String keyword) {
        Page<Symptom> page = new Page<>(currentPage,size);
        IPage<Symptom> symptomIPage = symptomMapper.getSymptomByPage(page,keyword);
        ResPageBean resPageBean = new ResPageBean(symptomIPage.getTotal(),symptomIPage.getRecords());
        return resPageBean;
    }
}
